<?php
/**
 * 快递服务
 * @author: wfs <605403358@qq.com>
 */
namespace base\kuaidi;

//$kuaidi = new \base\kuaidi\Kuaidi;
//$res =  $kuaidi->query('zhongtong','75803861936342');
		
class Kuaidi {
	
    //授权信息
    private $key;
    private $customer;
    private $type;
    private $config;
    
    //初始配置
    public function __construct($key='',$customer='')
    {
        $config = env('system_base_config_kuaidi'); 
        if(!$config){
           throw new \think\Exception( '请先配置微信应用信息' );
        }
        $this->type = $config['type'];
        $this->key = $config['key'];
        $this->customer = $config['customer'];
        $this->config = $config;
    }
    
	/*
    * 实时查询物流信息
    * @param $com 快递编码
    * @param $num 订单号
    */
	public  function query($com ='',$num=''){
	    $res = [];
        if($this->type == 'kuaidi100'){
            $kuaidi100 =  new \base\kuaidi\kuaidi100\Kuaidi100($this->key,$this->customer);    
            $res = $kuaidi100->query($com,$num);
        }
	   return $res;
    }
	
    /*
    * 实时查询轨迹地图
    * @param $com 快递编码
    * @param $num 订单号
    */
    public  function maptrack ($com ='',$num=''){
        $res = [];
        if($this->type == 'kuaidi100'){
            $kuaidi100 =  new \base\kuaidi\kuaidi100\Kuaidi100($this->key,$this->customer);    
            $res = $kuaidi100->maptrack($com,$num);
        }
       return $res;
    }
    
    
    /*
    * 实时查询轨迹地图
    */
    public  function getkdbm (){
        $res = [];
        if($this->type == 'kuaidi100'){
            $kuaidi100 =  new \base\kuaidi\kuaidi100\Kuaidi100($this->key,$this->customer);    
            $res = $kuaidi100->getkdbm();
        }
       return $res;
    }
    
}


?>